﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class catedetails : System.Web.UI.Page
{
    CodeDatDataContext con = new CodeDatDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.loadData();
        }
    }

    void loadData()
    {
        string strID= Request.QueryString["cate"];
        var item = from subcate in con.SubCates
                   where subcate.CateID == int.Parse(strID) && subcate.Display == true
                   select new {subcate.Category.Descript,subcate.SubCateTitle,subcate.DTVBs,subcate.SubCateID};
        rept1.DataSource = item;
        rept1.DataBind();
    }
    protected void rept1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Repeater rept2 = e.Item.FindControl("rept2") as Repeater;
        HiddenField hrId = (HiddenField)e.Item.FindControl("hdid");
        var iApp = from ap in con.DTVBs
                   where ap.SubCateID == int.Parse(hrId.Value.ToString())
                   select ap;
        rept2.DataSource = iApp;
        rept2.DataBind();
    }
    //protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    //{
    //    //Response.Redirect(Request.UrlReferrer.AbsoluteUri);
    //    // luu dia chi trang hien tai de quay lai sau khi login thanh cong
    //    if (Request.Url.AbsoluteUri != null)
    //    {
    //        Response.Redirect(Request.Url.AbsoluteUri);
    //    }

    //    // chuyen sang trang dang nhap
        
    //}
}
